import { Service } from "cl-admin";
import BaseService from "@/service/base";
@Service("serviceproduct")
class serviceproduct extends BaseService {
    // 产品列表
    list(params) {
        return this.$get("/list", { params });
    }
    // 获取某分类产品
    getByCategory({ size, ...args }) {
        let params = {
            ...args,
            page_size: size
        };
        return this.$get("/getByCategory", { params }).then(res => {
            return {
                list: res.data,
                pagination: {
                    ...params,
                    size,
                    total: res.total
                }
            };
        });
    }
    // 新增产品
    add(params) {
        return this.$post("/add", params);
    }
    //修改产品
    edit(params) {
        return this.$post("/edit", params);
    }
    //删除产品
    del(params) {
        return this.$post("/del", params);
    }
    //产品详情
    info(params) {
        return this.$get("/info", { params });
    }
}
export default serviceproduct;
